// import axios from 'axios';
// export function fetchResource(){
//   return  axios.get('/api/resources').then(res=>res.data)
// } 
import axios from "axios";
export function fetchResources() {
    return axios.get("/proxy/posts").then((res) => res.data);
}
export function updateResource(id, data) {
    return axios.patch(`/proxy/posts/${id}`, JSON.stringify(data)).then((res) => res.data);
}
export function deleteResource(id) {
    return axios.delete(`/proxy/posts/${id}`).then((res) => res.data);
}
export function createResource(data) {
    return axios.post(`/proxy/posts/`, JSON.stringify(data)).then((res) => res.data);
}
export function fetchResource(id) {
    return axios.get(`/proxy/posts/${id}`).then((res) => res.data);
}